﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace  word.others
{
    public partial class lockTime : Form
    {
        int m = 0;
        int s = 0;
        public lockTime()
        {
            InitializeComponent();
        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void btn_Start_Click(object sender, EventArgs e)
        {
            timer2.Interval = 100;
            timer2.Start();
            m = int.Parse(NUD_m.Value.ToString());
            s = int.Parse(NUD_s.Value.ToString());
            lbl_m.Text = m.ToString();
            lbl_s.Text = s.ToString();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (m == 0 && s == 0)
            {
                timer2.Stop();
                MessageBox.Show("定时完成","提示");
                return;
            }
            if (m>=0)
            {
                if (s>0&&s <= 60)
                {
                    --s;
                    lbl_s.Text = s.ToString();
                }
                else
                {
                    --m;
                    s = 60;
                    lbl_m.Text = m.ToString();
                    lbl_s.Text = s.ToString();
                }
            }
        }
    }
}
